package com.xiaoming.utils;

/***
 * http 请求头信息，提供200和404
 */
public class HttpProtocolUtil {

    public static String getHttpHeader200(long contentLength) {
        return "HTTP/1.1 200 OK \n " +
                "Content-Type: text/html \n" +
                "Content-Length:" + contentLength +
                "\n\r\n";
    }

    public static String getHttpHeader404() {
        String str404 = "<H1> 404 NOT FOUND <h1>";
        return "HTTP/1.1 404 NOT FOUND \n " +
                "Content-Type: text/html" +
                "Content-Length:" + str404.getBytes().length +
                "\n\r\n" + str404;
    }
}
